package cn.hrlly.tao2shou.presenter;

import cn.hrlly.tao2shou.biz.CancelApplicationBiz;
import cn.hrlly.tao2shou.biz.CancelApplicationBizImpl;
import cn.hrlly.tao2shou.domain.Applications;
import cn.hrlly.tao2shou.listener.OnCancelApplicationListener;
import cn.hrlly.tao2shou.view.view_interface.CancelApplicationView;

/**
 * User: gengliang
 * Date: 2016-01-30
 * Time: 19:39
 */

public class CancelApplicationPresenterImpl implements CancelApplicationPresenter,OnCancelApplicationListener {

    private CancelApplicationBiz cancelApplicationBiz;
    private CancelApplicationView cancelApplicationView;

    public CancelApplicationPresenterImpl(CancelApplicationView cancelApplicationView){
        this.cancelApplicationBiz=new CancelApplicationBizImpl(this);
        this.cancelApplicationView=cancelApplicationView;
    }

    @Override
    public void cancelApplication() {
        Applications applications=new Applications();
        applications.setApplicationId(cancelApplicationView.getApplicationId());
        cancelApplicationBiz.cancelApplication(applications);
    }

    @Override
    public void cancelApplicationSucc(String message) {
        cancelApplicationView.showMessage(message);
        cancelApplicationView.finishActivity();
    }

    @Override
    public void cancelApplicationSucc(int message) {
        cancelApplicationView.showMessage(message);
        cancelApplicationView.finishActivity();
    }

    @Override
    public void cancelApplicationFail(String errorMessage) {
        cancelApplicationView.showMessage(errorMessage);
    }

    @Override
    public void cancelApplicationFail(int errorMessage) {
        cancelApplicationView.showMessage(errorMessage);
    }
}
